﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iApprove.BL
{
    public class TokenManager
    {
        // Ref: http://stackoverflow.com/questions/1344221/how-can-i-generate-random-alphanumeric-strings-in-c
        //      http://stackoverflow.com/questions/730268/unique-random-string-generation

        private Random random = new Random();
        public string NonCriticalRandomToken(int length)
        {
            const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            return new string(Enumerable.Repeat(chars, length)
              .Select(s => s[random.Next(s.Length)]).ToArray());
        }
    }
}
